﻿using System;
namespace Producers.Etoimik.Xtee.Riik.Ee.Producer.Etoimik {
    
    
    [global::Xtee.Core.Attributes.XmlTypeAttribute(Name="LeiaMaksekorraldusedParing", Namespace="http://producers.etoimik.xtee.riik.ee/producer/etoimik", Target=typeof(LeiaMaksekorraldusedParing))]
    public class LeiaMaksekorraldusedParingSerializer : global::Xtee.Core.Types.AbstractXteeSerializable {
        
        protected ILeiaMaksekorraldusedParing clazz;
        
        public LeiaMaksekorraldusedParingSerializer(ILeiaMaksekorraldusedParing clazz) {
            this.clazz = clazz;
        }
        
        public override void WriteXml(global::Xtee.Core.IXteeXmlWriter Writer) {
            base.WriteXml(Writer);
            if (clazz.MaksekorralduseNr!=null) {
                Writer.WriteStartElement("maksekorralduseNr");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MaksekorralduseNr))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MaksjaNimi!=null) {
                Writer.WriteStartElement("maksjaNimi");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.MaksjaNimi))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MakseAegAlates!=null) {
                Writer.WriteStartElement("makseAegAlates");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.MakseAegAlates))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MakseAegKuni!=null) {
                Writer.WriteStartElement("makseAegKuni");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "dateTime");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdDateTime(((System.DateTime)(clazz.MakseAegKuni))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.MakseViis!=null) {
                Writer.WriteStartElement("makseViis");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.MakseViis))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Pank!=null) {
                Writer.WriteStartElement("pank");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "long");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdLong(((long)(clazz.Pank))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Viitenumber!=null) {
                Writer.WriteStartElement("viitenumber");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Viitenumber))).ToString());
                Writer.WriteEndElement();
            }
            if (clazz.Selgitus!=null) {
                Writer.WriteStartElement("selgitus");
                Writer.WriteTypeAttribute("http://www.w3.org/2001/XMLSchema", "string");
                Writer.WriteString(new global::Xtee.Core.Schema.XsdString(((string)(clazz.Selgitus))).ToString());
                Writer.WriteEndElement();
            }
        }
        
        public override void ReadXml(global::Xtee.Core.IXteeXmlReader Reader) {
            base.ReadXml(Reader);
        START:
            if ((Reader.LocalName == "maksekorralduseNr")) {
                goto maksekorralduseNr;
            }
            else {
                if ((Reader.LocalName == "maksjaNimi")) {
                    goto maksjaNimi;
                }
                else {
                    if ((Reader.LocalName == "makseAegAlates")) {
                        goto makseAegAlates;
                    }
                    else {
                        if ((Reader.LocalName == "makseAegKuni")) {
                            goto makseAegKuni;
                        }
                        else {
                            if ((Reader.LocalName == "makseViis")) {
                                goto makseViis;
                            }
                            else {
                                if ((Reader.LocalName == "pank")) {
                                    goto pank;
                                }
                                else {
                                    if ((Reader.LocalName == "viitenumber")) {
                                        goto viitenumber;
                                    }
                                    else {
                                        if ((Reader.LocalName == "selgitus")) {
                                            goto selgitus;
                                        }
                                        else {
                                            return;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        maksekorralduseNr:
            if ((Reader.IsElementNil() == false)) {
                clazz.MaksekorralduseNr = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("maksekorralduseNr")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        maksjaNimi:
            if ((Reader.IsElementNil() == false)) {
                clazz.MaksjaNimi = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("maksjaNimi")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        makseAegAlates:
            if ((Reader.IsElementNil() == false)) {
                clazz.MakseAegAlates = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("makseAegAlates")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        makseAegKuni:
            if ((Reader.IsElementNil() == false)) {
                clazz.MakseAegKuni = new global::Xtee.Core.Schema.XsdDateTime(Reader.ReadElementString("makseAegKuni")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        makseViis:
            if ((Reader.IsElementNil() == false)) {
                clazz.MakseViis = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("makseViis")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        pank:
            if ((Reader.IsElementNil() == false)) {
                clazz.Pank = new global::Xtee.Core.Schema.XsdLong(Reader.ReadElementString("pank")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        viitenumber:
            if ((Reader.IsElementNil() == false)) {
                clazz.Viitenumber = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("viitenumber")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        selgitus:
            if ((Reader.IsElementNil() == false)) {
                clazz.Selgitus = new global::Xtee.Core.Schema.XsdString(Reader.ReadElementString("selgitus")).Value;
            }
            else {
                Reader.Skip();
            }
            goto START;
        }
    }
}
